--[[

	Copyright (c) 2012-2020 baby-bus.com

	TODO:   Main
	Author: DemonYao
	Date:   2020.10.14
 
	http://www.babybus.com/ 

]] 




--------------------------
-- 引入命名空间
--------------------------
-- local BaseLayer = import("app.common.layer.BaseLayer")




--[[
	类
--]]


local M = classLayerTouch("Main")




--------------------------
-- 构造函数
--------------------------

function M:ctor(params)
	-- [超类调用]
	M.super.ctor(self, params)
	-- [本类调用]

end

--------------------------
-- 渲染
--------------------------

function M:onRender()
	-- [超类调用]
	M.super.onRender(self)
	local bg = U.loadBg("background.png"):to(self)

	-- [本类调用]
	self:initDragonBonesData()
	-- 加载节点
	self:loadNodes()
end

-- 加载节点
function M:loadNodes()
	self:loadRobot()
end

-- 加载渲染以外的其他操作
function M:onEnterTransitionFinish()
	--
end


function M:initDragonBonesData()
	-- dragonBones.CCFactory:loadDragonBonesData("mecha_1502b/mecha_1502b_ske.json")
	-- dragonBones.CCFactory:loadTextureAtlasData("mecha_1502b/mecha_1502b_tex.json")

	dragonBones.CCFactory:loadDragonBonesData("resource/skin_1502b/skin_1502b_ske.json")
	dragonBones.CCFactory:loadTextureAtlasData("resource/skin_1502b/skin_1502b_tex.json")

	dragonBones.CCFactory:loadDragonBonesData("weapon_1000/weapon_1000_ske.json")
	dragonBones.CCFactory:loadTextureAtlasData("resource/weapon_1000/weapon_1000_tex.json")
end

-- 创建机器人
function M:loadRobot()
	self.robot = self:createNode("Robot", {
		dragonBonesDataFile = "mecha_1502b/mecha_1502b_ske.json",
		dragonBonesTexFile  = "mecha_1502b/mecha_1502b_tex.json",
		armatureName        = "mecha_1502b",
		animName			= "idle"
	}):p(580, 220):to(self)
end

--------------------------
-- 触控
-------------------------- 

function M:onTouchBegan(x, y, touches)
	--  触控有效
	return true 
end

function M:onTouchMoved(x, y, touches)
	--   
end

function M:onTouchEnded(x, y, touches)
	--  
end



--------------------------
-- 功能函数
--------------------------




--------------------------
-- 属性
--------------------------




--------------------------
-- 父类重写
--------------------------




----------------------------------------------------
-- 析构
--------------------------

function M:onDestructor()
	-- [超类调用]
	M.super.onDestructor(self)
	-- [本类调用]

end








return M






